/*
*
* Copyright (c) 2011 Vaulting Systems International
* 
* Permission is hereby granted, free of charge, to any person obtaining a copy 
* of this software and associated documentation files (the "Software"), to deal 
* in the Software without restriction, including without limitation the rights 
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 
* of the Software, and to permit persons to whom the Software is furnished to do  
* so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all  
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A 
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE  
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
*/
package com.ekeymanlib.domain;

import java.io.Serializable;
import java.util.Set;


public class Vendor implements Serializable{

	private static final long serialVersionUID = 1323180015755105169L;
	private long id;
	private String name;
	private String address;
	private String city;
	private String state;
	private String zip;
	private String phone;
	private String emailAddress;
	private String apiKey;	
	private int disabled;
	private long version;
	private Set<AppDevice> appDevices;
	private Set<User> users;
	
	public void setId(long id) {
		this.id = id;
	}
	public long getId() {
		return id;
	}
	
	public void setName(String name) {
		this.name = name;
	}
	public String getName() {
		return name;
	}
	
	public void setAddress(String address) {
		this.address = address;
	}
	public String getAddress() {
		return address;
	}
	public void setCity(String city) {
		this.city = city;
	}
	public String getCity() {
		return city;
	}
	public void setState(String state) {
		this.state = state;
	}
	public String getState() {
		return state;
	}
	public void setZip(String zip) {
		this.zip = zip;
	}
	public String getZip() {
		return zip;
	}
	public void setPhone(String phone) {
		this.phone = phone;
	}
	public String getPhone() {
		return phone;
	}
	public void setEmailAddress(String emailAddress) {
		this.emailAddress = emailAddress;
	}
	public String getEmailAddress() {
		return emailAddress;
	}
	public void setDisabled(int disabled) {
		this.disabled = disabled;
	}
	public int getDisabled() {
		return disabled;
	}
	public void setAppDevices(Set<AppDevice> appDevices) {
		this.appDevices = appDevices;
	}
	public Set<AppDevice> getAppDevices() {
		return appDevices;
	}
	
	public void setUsers(Set<User> users) {
		this.users = users;
	}
	public Set<User> getUsers() {
		return users;
	}
	
	public void setApiKey(String apiKey) {
		this.apiKey = apiKey;
	}
	public String getApiKey() {
		return apiKey;
	}
	
	public void setVersion(long version) {
		this.version = version;
	}
	public long getVersion() {
		return version;
	}
	@Override
	public boolean equals(Object o){
		boolean result = false;
		if (o instanceof Vendor){
			Vendor vak = (Vendor)o;
			if(apiKey.equalsIgnoreCase(vak.getApiKey())) {
				result = true;
			}
		}
		return result;
	}
	
	@Override
	public int hashCode(){
		return (int)id + apiKey.hashCode();
	}
}
